package com.addedstuff;

import brianchen.util;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class EnderDragonWand extends ItemSword 
{
//This Wand will spawn EnderDragons
	public EnderDragonWand(int par1, EnumToolMaterial par2EnumToolMaterial) 
	{
		super(par1, par2EnumToolMaterial);
		this.setCreativeTab(CreativeTabs.tabCombat);
		// TODO Auto-generated constructor stub
		
	}
	public void registerIcons(IconRegister iconReg)
    {
        itemIcon = iconReg.registerIcon("Brianmodbase:EnderWand");
    }
	 
	public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
	{
		if (!par2World.isRemote)
		{
			Vec3 vec  = util.placeInFrontOfEntity(par3EntityPlayer, 50);
			EntityDragon dragon = new EntityDragon(par2World);
			
			dragon.setPosition(vec.xCoord, 200, vec.zCoord);
			par2World.spawnEntityInWorld(dragon);
			par1ItemStack.damageItem(5000, par3EntityPlayer);
		}
		return par1ItemStack;
		 
	}
}
	